Brief Full Advanced Search Search Tips
|  |  | To access the contents, click the chapter and section titles. Visual Basic 6 Programming Blue Book: The Most Complete, Hands-On Resource for Writing Programs with Microsoft Visual Basic 6! (Publisher: The Coriolis Group) Author(s): Peter G. Aitken ISBN: 1576102815 Publication Date: 08/01/98 Search this book:
Previous | Table of Contents | Next
## Chapter 16 Multimedia Magic Some say that multimedia is the wave of the future. If this is true, Visual Basic can be your surfboard. Everyone seems to be going multimedia crazy. You can’t open a daily newspaper without seeing ads for “multimedia PCs” on sale at the local lawn and garden store or gas station. An exaggeration perhaps, but you know what I mean. Lots of people have heard about multimedia, and more and more of them are expecting to see multimedia when they fire up their PCs. What does this mean for you, Joe or Jane Programmer? When programming for fun, multimedia projects can be enjoyable and rewarding. If you program for a living, knowing multimedia is a necessity. You can bet your competition does. Whatever the reasons, you’ll be pleasantly surprised at how easy multimedia programming is, because all of the essential capabilities are built into Visual Basic and Windows. I won’t pretend that this chapter provides complete coverage of Visual Basic’s multimedia capabilities. The subject would require an entire book, and in fact, a very good book has been written by Anthony Potts, Chris D. Coppola, and Scott Jarol: Visual Basic 5 Web & Multimedia Adventure Set, published by The Coriolis Group. For an in-depth treatment, I suggest you turn to this book. My goal in this chapter is simply to show you how to perform the basic, common multimedia operations—namely, playing sound and video. ### What Is Multimedia? The meaning of the word multimedia is more elusive than it appears at first glance. Media is the plural of medium, a means or method of communication. Multimedia, then, literally means more than one method of communication. When your kid sister is screaming at you and whacking you on the head at the same time, that’s multimedia. Of course, this is a far cry from computer multimedia. When you experience a computer playing stereo sound through a pair of high-tech speakers while showing a video on screen, that’s multimedia. But what about a hypertext presentation that combines text and pictures—is that multimedia? How about an animated icon? Determining the exact boundaries can be difficult, but it really doesn’t matter. Whether you call it multimedia, interface enhancement, or chopped liver, the bottom line is still the same: You need to know how to program this stuff. Thanks to Windows and Visual Basic, the challenge has been greatly simplified. ### The Multimedia PC Standard While not all multimedia requires special hardware, much of it does. To reduce confusion and give developers a target platform, Microsoft developed the Multimedia PC (MPC) standard, a specification of the minimum hardware required for a computer to be considered MPC compatible: • A 386SX or better microprocessor • A minimum of 2MB of memory • A VGA display system • An MPC-compatible sound card supporting PCM playback of WAV files, MIDI (Musical Instrument Digital Interface) playback through a synthesizer, and an internal audio mixer • A CD-ROM drive with a seek time under one second and a data transfer rate of at least 150K per second By today’s hardware standards, such a system seems almost quaint. In fact, you probably couldn’t buy a system with exactly those specifications without heading for the flea market in Last Chance, Nev. With a CD-ROM built into almost every PC sold today, the only necessary addition is the sound card. If your system is not MPC ready, I recommend investigating the various available multimedia kits that include a sound card, speakers, CD-ROM drive, and software. This route is probably the easiest and most economical way to upgrade. Note that the equipment on an MPC-compatible PC does not encompass all the possible multimedia hardware. Various kinds of specialized devices, such as video disk players and image scanners, are supported under Windows’ multimedia capabilities. The MPC standard simply defines the minimum level of hardware that a developer can assume the end user will have. ### The Windows Media Control Interface Programs use the Windows Media Control Interface (MCI) to interact with multimedia hardware. Hardware can consist of any media devices that Windows supports: audio CD players, audio boards, MIDI sequencers, videodisc players, and videotape players and recorders. At the software end is a standard command syntax. Your program issues standard commands; the MCI, working with the specific drivers for the device in use, translates these commands to the exact signals required to carry out the requested action. Thus, the Play command starts playback, whether it’s an audio CD, a MIDI file, or a video clip. Figure 16.1 illustrates the relationship between your program, the MCI, and multimedia devices. Table 16.1 lists the multimedia devices supported by Windows. New devices are added as they become popular, so this list may have already expanded by the time you read this. Table 16.1 Multimedia devices supported by Windows.
Device ID | Description
--- | ---
AVIVideo | Digital video
CDAudio | Standard audio CD
DAT | Digital audio tape
DigitalVideo | Digital video
MMMovie | Multimedia movie
Other | Undefined device
Overlay | Analog video
Scanner | Image scanner
Sequencer | MIDI sequencer
VCR | Videocassette recorder
Videodisc | Videodisc player
WaveAudio | Digital audio
Figure 16.1 The Media Control Interface mediates interactions between your program and multimedia hardware devices. Note that the term device does not refer to a discrete physical component, such as a sound card or a CD-ROM drive. It’s more accurate to think of a device as one format of multimedia data that Windows is capable of playing. For example, CDAudio and WaveAudio are two distinct multimedia devices that use the computer’s sound card to play digital music. They differ in the source of the digital data: for CDAudio, an audio CD in the CD-ROM drive; for WaveAudio, a file on disk. AVIVideo requires no special hardware to play digital video images on standard video display hardware (although a sound card, if present, will be used to play the accompanying soundtrack). TIP: How Multimedia Sound Works The two types of multimedia sound are digital and MIDI. With digital sound, the original audio waveform is sampled digitally, and the resulting digital samples, or numerical values, are saved. During playback, those digital values are retrieved and sent to a digital-to-analog converter (DAC) on the sound card, which converts them back into a reasonable approximation of the original waveform. The source of the digital data can be either a WAV file (*.WAV) on disk or a standard audio CD in the computer’s CD-ROM drive. Musical Instrument Digital Interface (MIDI) sound stores a series of commands. The commands specify the length, loudness, pitch, and other characteristics of each note. During playback, the commands are sent to the MIDI synthesizer on the sound card, which converts them into the corresponding sounds.
Previous | Table of Contents | Next

| Products | Contact Us | About Us | Privacy | Ad Info | Home Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.